<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <!-- 值传递 -->
  <!-- 地址传递 -->
  <script>
    function cal(a,b) {
      t=a;a=b;b=t;
      console.log("a="+a+",b="+b);
    }
    var x=12,y=34;
    cal(x,y);
    console.log("x="+x+",y="+y);

    var str = new String();
    var date = new Date();
    //person对象，构造函数方式
    function Person(name,age){
      this.name  = name;
      this.age = age;
      this.sayHello = function(){
        console.log("大家好");
      }
    }
    Person.prototype.study = function(){
      console.log("学习");
    }
    Person.prototype.major = "软件技术";
    var p1 = new Person("zhangsan",12);
    var p2 = new Person("lisi",34);
    console.log(p1.sayHello == p2.sayHello);
    console.log(p1.study == p2.study);
    console.log(p2.major);    
    console.log(p1.major);

    var newObj = Object.create(Person);
    newObj.prototype.work = function(){
      
    }
    
  </script>
</body>
</html>